<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
<%@ taglib uri="http://www.springframework.org/tags" prefix="spring"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8" isELIgnored="false"%>
<html>
<head>
<title>Trang chủ</title>
</head>
<body>
	<c:forEach var="bookType" items="${category}">
		<c:set var="listBooks" value="${bookMap[bookType.id]}" />
		<div class="list-view">
			<div class="pr-head collapse">
				<span>${bookType.name }</span><a class="btn-more-pr">Xem thêm</a>
			</div>
			<ul class="pr-list" id="list1">
				<c:forEach var="item" items="${listBooks}">
					<li class="pr-item">
						<a class="pr-mask" href="book-detail?index=${item.id}" title="Xem chi tiết">
						<div class="pr-img"	style="background-image: url('getBookImage?bookId=${item.id}')"></div>
						<c:if test="${item.discount > 0}">
							<div class="giam-gia">-<fmt:formatNumber pattern="###,###.##" value="${item.discount }" />%</div>
						</c:if>
						<a class="pr-btn">Add</a>
						</a>
						<c:choose>
							<c:when test="${item.discount > 0}">
								<div class="pr-info" style="margin: 140px 5px 0;">
							</c:when>
							<c:otherwise>
								<div class="pr-info">
							</c:otherwise>
						</c:choose>
						
							<span class="pr-name">${item.name}</span> <span
								class="pr-desc">${item.shortDescription}</span>
								<c:if test="${item.discount > 0}">
									Giá cũ: <span class="original-price"><fmt:formatNumber pattern="#,###.##" value="${item.price}"/> VNĐ</span>
								</c:if> 
								<span class="pr-price" data="${item.id }"><fmt:formatNumber pattern="#,###.##" value="${item.price - (item.price*item.discount/100)}"/> VNĐ</span>
						</div>
					</li>
				</c:forEach>
			</ul>
		</div>

	</c:forEach>

</body>
</html>